package org.streets.workflow.engine;

import java.util.List;

import org.streets.workflow.engine.event.INodeEventListener;
import org.streets.workflow.engine.event.NodeEvent;
import org.streets.workflow.model.net.WFNode;

/**
 * 节点接口
 * @author dzb
 */
public interface INode {
    /**
     * 节点类型枚举
     * @author dzb
     */
    public enum NodeType {Start, Router, Activity, End};
    
	/**
	 * 获取节点实例ID
	 * @return
	 */
	public String getNodeId();	
	/**
	 * 获取节点类型
	 * @return
	 */
	public NodeType getNodeType();
	/**
	 * 获取节点模型定义
	 * @param <T>
	 * @return
	 */
	public <T extends WFNode> T getNodeModel();
	/**
	 * 获取输出弧的实例
	 * @return
	 */
	public List<ITransition> getLeavingTransitions();
	/**
	 * @param transition
	 */
	public void addLeavingTransition(ITransition transition);	
	/**
	 * @return
	 */
	public List<ITransition> getEnteringTransitions();
	/**
	 * @param transitionInstance
	 */
	public void addEnteringTransition(ITransition transitionInstance);
	/**
	 * @return
	 */
	public List<ILoop> getLeavingLoops();
	/**
	 * @param loopInstance
	 */
	public void addLeavingLoop(ILoop loopInstance);
	/**
	 * @return
	 */
	public List<ILoop> getEnteringLoops();
	/**
	 * @param loopInstance
	 */
	public void addEnteringLoop(ILoop loopInstance);	
	/**
	 * @return
	 */
	public List<INodeEventListener> getEventListeners();	
	/**
	 * 触发节点事件 
	 */
	public void fireNodeEvent(WorkflowEngine engine, NodeEvent event) throws WorkflowException;

}
